<template>
  <div class="page-box">
    <button
      id="btnPageUp"
      :disabled="currentPage === 1"
      @click="handleClick('prev', 1)"
    >
      上一页
    </button>
    <button
      id="btnPageDown"
      :disabled="currentPage === totalPage"
      @click="handleClick('next', 1)"
    >
      下一页</button
    ><span id="pageSpan"><slot></slot></span>
  </div>
</template>

<script>
import EventBus from "@/EventBus";
export default {
  components: {
    EventBus,
  },
  props: {
    currentPage: {
      type: Number,
      required: true,
    },
    totalPage: {
      type: Number,
      required: true,
    },
  },
  methods: {

    //param{direct:next or prev, num:1page} use eventbus to transfer data
    handleClick(direct, num) {
      EventBus.$emit(direct, num);
    },
  },
};
</script>

<style>
</style>